package com.learn.educourseboot.controller;

import com.learn.eduapi.entity.CourseType;
import com.learn.educourseboot.service.CourseTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class CourseTypeController {

    @Autowired
    private CourseTypeService courseTypeService;

    @RequestMapping("/course-types")
    public ResponseEntity<List<CourseType>> getAllCourseTypes(){
        List<CourseType> list = courseTypeService.list();
        return ResponseEntity.ok(list);
    }
}
